package cn.wolfcode.util;

import lombok.Getter;
import lombok.Setter;
import org.springframework.format.annotation.DateTimeFormat;

import java.util.Calendar;
import java.util.Date;

//报表高查参数
@Getter
@Setter
public class CustomerReportQueryObject extends QueryObject{
    //按照姓名分组
    private String groupType = "e.name";
    private String keyword;
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    //开始时间
    private Date beginDate;
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    //结束时间
    private Date endDate;
    //结束时间+1天(给sql用)
    public Date getLastDate(){
        if (endDate != null) {
            Calendar c = Calendar.getInstance();
            c.setTime(endDate);
            c.add(Calendar.DATE, 1);
            return c.getTime();
        }
        return null;
    }
}